#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;

class Solution {
public :
    int Max(vector<int>& nums) {
        int ret = nums[0];
        for (auto x : nums) {
            ret = max(ret, x);
        }
        return ret;
    }
};

#ifndef COMPLIE_OLINE
#include "header.cpp"
#endif
#include <ctime>
#include <chrono> 

// 正解
int Max(vector<int>& nums) {
    int ret = nums[0];
    for (auto x : nums) {
        ret = max(ret, x);
    }
    return ret;
}

int main() {
    srand(time(nullptr));
    Solution s;
    int cnt = rand() % 10000 + 1; // 测试用例个数
    // 获取当前时间点  
    auto start = std::chrono::high_resolution_clock::now();  
    for (int i = 1; i <= cnt; i++) {
        int len = rand() % 20 + 2;
        vector<int> nums(len);
        for (int j = 0; j < len; j++) {
            nums[j] = rand() % 1000;
        }
        int true_ret = Max(nums); 
        int test_ret = s.Max(nums);// **********************************
        if (true_ret != test_ret) {
            cerr << "测试通过" << i - 1 << "个测试用例" << endl;
            cerr << "用例" << i << ":[";
            for (auto x : nums) {
                cout << x << " ";
            }
            cerr << "]" << endl;
            cerr << "预计输出: " << true_ret << endl;
            cerr << "实际输出: " << test_ret << endl;
            return 0;
        }
    }
    cout << "通过所有的" << cnt << "个测试用例!" << endl;
    // 获取结束时间点  
    auto end = std::chrono::high_resolution_clock::now();  
  
    // 计算两个时间点之间的持续时间  
    auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(end - start);  
  
    // 输出持续时间（毫秒）  
    std::cout << "运行时间: " << duration.count() << " ms" << std::endl;  
    return 0;
}

